package ModelImplementation

import (
	Model "PaySalary/Model"
	"time"
)

type BiweeklySchedule struct {
	Model.PaymentSchedule
}


func (b *BiweeklySchedule)BIsPaydate(payDate time.Time) bool {
	firstPayableFriday := time.Date(2001,11,9,0,0,0,0,time.Local)
	ts := payDate.Sub(firstPayableFriday)

	daysSinceFirstPayableFriday := (int)(ts.Hours()) / 24
	
	return (daysSinceFirstPayableFriday % 14) == 0
}

func (b *BiweeklySchedule)BGetPayPeriodStartDate(payPeriodEndDate time.Time) time.Time {
	return payPeriodEndDate.AddDate(0,0,-13)
}